#!/bin/bash

#kubectl get ns -A --kubeconfig=/root/.kube/config-y3pre|awk '{print $1}'|grep -w ^$1$
#  if [[ $? -eq 0 ]];then
#     env=y3pre
#  else
#    kubectl get ns -A --kubeconfig=/root/.kube/config-DQ|awk '{print $1}'|grep -w ^$1$
#      if [[ $? -eq 0 ]];then
#        env=DQ
#      else
#        kubectl get ns -A --kubeconfig=/root/.kube/config-117|awk '{print $1}'|grep -w ^$1$
#          if [[ $? -eq 0 ]];then
#            env=117
#          fi
#  fi
#fi

for i in y3pre DQ 117
do
kubectl get ns -A --kubeconfig=/root/.kube/config-$i|awk '{print $1}'|grep -w ^$1$
          if [[ $? -eq 0 ]];then
            env=$i
          fi
done
if [[ ! -z $env ]];then
  echo "env="$env
else
  echo "error args !!"
  exit 1
fi
